package cn.yibao.interviewtest.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
@Component
public class MyInitializingBean implements InitializingBean {
    public MyInitializingBean(){
        System.out.println("执行了MyInitializingBean构造方法");
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("执行了afterprocessSet方法");
    }

    @PostConstruct
    public void postconstruct(){
        System.out.println("执行了postconstruct方法");
    }

    public void test(){
        System.out.println("执行了test方法");
    }

    public void init(){
        System.out.println("执行了init方法");
    }

    @Bean(initMethod = "test")
    public MyInitializingBean initMethod(){
        return new MyInitializingBean();
    }
}
